package myTest;

public class StringLockTest {

	public static void main(String[] args) {
		new Thread(){
			@Override
			public void run(){
				synchronized ("ss") {
					System.out.println("im thread one and lock ss");
					try {
						Thread.sleep(5000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		}.start();
		new Thread(){
			@Override
			public void run(){
				//synchronized ("ss") {
				synchronized (new String("ss")) {
					System.out.println("im thread two and lock ss");
					try {
						Thread.sleep(5000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		}.start();
	}

}
